package com.cas.scalls.util;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;


public class TcpClientUtil {
	
	public void service() {
		Socket s =null; 
		BufferedReader reader = null;
		BufferedWriter writer = null;
		try {
			s = new  Socket("127.0.0.1",8888);
			reader = new BufferedReader(new InputStreamReader(System.in));
			writer = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
			String str =null;
			while(!"bye".equals(str)) {
				str =reader.readLine();
				writer.write(str);
				writer.newLine();
				writer.flush();
			}
		} catch(IOException e) {
			e.printStackTrace();
		} finally {
			try {
				s.close();
				reader.close();
			} catch(IOException e) {
				e.printStackTrace();
			}
		}
	}
	public void sendMsg(){
		
	}
	public String recivedMsg(){
		
		return null;
	}
}